
<template>
<div><el-dialog
    title="提示"
    :visible.sync="dialogVisible"
    width="30%"
     >
  <span> <el-form ref="form" :model="form" label-width="80px">
    <el-form-item label="园区名称">
      <el-input v-model="form.name"></el-input>
    </el-form-item>
    <el-form-item label="园区名称">
      <el-input v-model="form.address"></el-input>
    </el-form-item>
  </el-form></span>

  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </span>
</el-dialog></div>
</template>
<script>
import {_areaModify} from '../../../../api/super_admin'
// import JSONBig from 'json-bigint'
export default {
  name: 'AreaEditDialog',
  data () {
    return {
      dialogVisible: false,
      form: {
        name: '',
        address: ''
      }
    }
  },
  methods: {
    show (Area) {
      this.dialogVisible = true
      this.form = JSON.parse(JSON.stringify(Area))
    },
    submit () {
      let OBJ = JSON.parse(JSON.stringify(this.form))
      console.log(OBJ)
      if (this.form.name === '' || this.form.address === '') {
        this.$message({
          message: '园区名称和园区地址必须非空',
          type: 'error'
        })
      } else {
        _areaModify(OBJ).then(res => {
          // console.log(res)
          if (res.status) {
            this.$message({
              message: '修改成功',
              type: 'success'
            })
            this.dialogVisible = false
            this.$emit('ok')
          } else {
            this.$message({
              message: '修改失败',
              type: 'error'
            })
          }
        })
      }
    }
  }
}
</script>
<style scoped>

</style>
